<?php
class Accueil extends ObjectModel 
  {
  /** @var string Name */
  public $id_accueil;
  
  public $titre;
  
  public $texte;
  
  public $img;
  
  public $lien;
 
  protected $fieldsRequired = array('titre','texte','lien');
  protected $fieldsSize = array('titre' => 128, 'texte' =>65000, 'lien'=>254 );
  protected $fieldsValidate = array('id_accueil' => 'isUnsignedId');
  
  protected $table = 'accueil';
  protected $identifier = 'id_accueil';
 
  public function getFields() 
  {
    parent::validateFields();
    
    $fields['titre'] = pSQL($this->titre);
    $fields['texte'] = pSQL($this->texte);
    $fields['lien'] = pSQL($this->lien);
    return $fields;
    
   }
   
  public static function getBlocsAccueil()
	{
		return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT *
		FROM `'._DB_PREFIX_.'accueil`
		ORDER BY `id_accueil` DESC');
	}
   
  }
?>